package com.googlecode.bipol.war.session;

import java.sql.Timestamp;
import java.util.Date;
import java.util.Map;
import com.googlecode.bip.entity.IGenericUser;

/**
 * TODO: Doc!
 *
 */
public interface IBipSession
{
    /**
     * Returns current user name
     * @return current user name
     */
    public String getUsername();

    /**
     * Returns current user properties
     * @return current user properties
     */
    public Map<String,String> getUserProperties();

    /**
     * Invalidate HttpSession, object no more valid !
     */
    public void invalidateSession();

    /**
     * Returns true if current user is connected as a {@link Roles#BIP_USER}.
     * @return true if current user is connected as a {@link Roles#BIP_USER}.
     * @see #getIUser()
     */
    public boolean isBipUser();

    /**
     * Returns true if current user is connected as a {@link Roles#BIP_AUTHOR}.
     * @return true if current user is connected as a {@link Roles#BIP_AUTHOR}.
     */
    public boolean isBipAuthor();

    /**
     * Returns true if current user is connected as a {@link Roles#BIP_REF}.
     * @return true if current user is connected as a {@link Roles#BIP_REF}.
     */
    public boolean isBipReferent();

    /**
     * Returns true if current user is connected as a {@link Roles#BIP_ADMIN}.
     * @return true if current user is connected as a {@link Roles#BIP_ADMIN}.
     */
    boolean isBipSuperAdministrator();

    /**
     * Returns {@link IGenericUser} object associate with current user if any.
     * @return a valid {@link IGenericUser} or null.
     */
    public IGenericUser getGenericUser();

    /**
     * Returns current date for survey (default is current date)
     * @return current date for survey
     */
    public Timestamp getUserDate();

    /**
     * Set current date for survey.
     *
     * @param date Valid date
     */
    void setUserDate( Date date );

}
